#ifndef YATUN_SERVER_H
#define YATUN_SERVER_H

#include "Yatun.h"
#include "ConfigParser.h"
#include "c_Plug_IO.h"
#include "IO_Tun.h"
#include "IO_UDP.h"
#include "IO_TCP.h"


#include <sys/socket.h> 
#include <netinet/in.h> 
#include <arpa/inet.h> 

#include <sys/time.h>

#include <vector>


struct YatunServerConf {
    int Port;
    int UseMServer;
    short Flags;
    struct timeval TunnelTimeout;

    char *ServerName;
    char *mServerAddress;
    int mServerPort;

};

class YatunClient {
private:
    char *ServerName;
    char *mServerAddress;
    int mServerPort;
    
    IO_TCP *IOIncome;
    IO_UDP *IOmServer;
    
    ConfigParser *Config;
    std::vector<*Tunnel> Tunnels;

    c_Plug_IO* Negotiate(c_Plug_IO *);
//    int RegisterServer();
    
public:
    YatunServer(ConfigParser *);
    ~YatunServer();

    int SetConf(struct YatunServerConf &);
};

#endif
